---
layout: m1x_soap
title: Order Cancel
---

<h2><a name="sales_order.cancel-Module%3AMageSales"></a>Module: Mage_Sales</h2>


<h4><a name="sales_order.cancel-Resource%3Asalesorder"></a>Resource: sales_order</h4>

<p><b>Aliases</b>:</p>
<ul>
	<li>order</li>
</ul>


<h5><a name="sales_order.cancel-Method%3A"></a>Method:</h5>

<ul>
	<li>sales_order.cancel (SOAP V1)</li>
	<li>salesOrderCancel (SOAP V2)</li>
</ul>


<p>Allows you to cancel the required order.</p>

<p><b>Aliases</b>:</p>
<ul>
	<li>order.cancel</li>
</ul>



<p><b>Arguments</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId <br class="atl-forced-newline" /> </td>
<td> Session ID </td>
</tr>
<tr>
<td> string </td>
<td> orderIncrementId <br class="atl-forced-newline" /> </td>
<td> Order increment ID </td>
</tr>
</tbody></table>


<p><b>Returns</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Description </th>
</tr>
<tr>
<td> boolean </td>
<td> True if the order is canceled </td>
</tr>
</tbody></table>



<h4><a name="sales_order.cancel-Examples"></a>Examples</h4>

<h5><a name="sales_order.cancel-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires api authentification,
// then get a session token
$session = $client-&gt;login('apiUser', 'apiKey');

$result = $client-&gt;call($session, 'sales_order.cancel', '200000004');
var_dump($result);

// If you don't need the session anymore
//$client-&gt;endSession($session);</pre>
		</div>
</div></div>

<h5><a name="sales_order.cancel-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy-&gt;login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy-&gt;salesOrderCancel($sessionId, '200000004');
var_dump($result);</pre>
		</div>
</div></div>


<h5><a name="sales_order.cancel-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey')); 
 
$result = $proxy-&gt;salesOrderCancel((object)array('sessionId' =&gt; $sessionId-&gt;result, 'orderIncrementId' =&gt; '200000004'));   
var_dump($result-&gt;result);</pre>
		</div>
</div></div>

<?php include(__ROOT__ . 'footer.php'); ?>
